/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import java.io.IOException;
import java.util.Date;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import model.Student;
import org.xml.sax.SAXException;

/**
 *
 * @author Phillipp
 */

public class Studentmanagement {
 
Student[] students = new Student[9999];   

    //when Studentmanagement is generated, it should read the student.xml and import all data into the students array
    public Studentmanagement(){
        for(int i = 0; i < students.length; i++){
            //students[i]= new Student.getData from xml; //fill array with existing students from the xml
        }
    }

    public void addStudent(String studentFirstName, String studentLastName, String title, String gender, String officialAdress, 
                    String currentAdress, String email, String phoneNumber, 
                    String matriculationNumber, Date dateOfBirth, String studies, int semester, String degree) throws SAXException, IOException, ParserConfigurationException, TransformerException{
        int x = 0;
        while(students[x] != null){
            x++;
        }
        students[x] = new Student(studentFirstName, studentLastName, title, gender, officialAdress, 
                    currentAdress, email, phoneNumber, matriculationNumber, dateOfBirth, studies, semester, degree);
        students[x].saveStudent(studentFirstName, studentLastName, title, gender, officialAdress, currentAdress, email, phoneNumber, 
                    matriculationNumber, dateOfBirth, studies, semester, degree);    
    }
    
    public Student[] getStudents(){
        return students;
    }
  
}
